package main

import (
	_ "beego_demo/routers"
	"github.com/astaxie/beego"
	"fmt"
	"github.com/astaxie/beego/context"
)

func main() {
	error := beego.LoadAppConfig("ini", "D:\\workspace_godemo\\src\\beego_demo\\conf\\app.conf")
	if error != nil {
		fmt.Println(error.Error())
	}

	beego.InsertFilter("/*", beego.BeforeStatic, func(context *context.Context) {
		fmt.Printf("method %s in BeforeStatic filter\n", context.Request.URL.String())
	})
	beego.InsertFilter("/*", beego.BeforeRouter, func(context *context.Context) {
		fmt.Printf("method %s in BeforeRouter filter\n", context.Request.URL.String())
	})
	beego.InsertFilter("/*", beego.BeforeExec, func(context *context.Context) {
		fmt.Printf("method %s in BeforeExec filter\n", context.Request.URL.String())
	})
	beego.InsertFilter("/*", beego.AfterExec, func(context *context.Context) {
		fmt.Printf("method %s in AfterExec filter\n", context.Request.URL.String())
	})
	beego.InsertFilter("/*", beego.FinishRouter, func(context *context.Context) {
		fmt.Printf("method %s in FinishRouter filter\n", context.Request.URL.String())
	})

	beego.Run()
}
